﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;

namespace ServiceLayer.Entity
{
    [DataContract]
    public class CollectionPointW
    {
        int collectionPointID;
        string collectionPointName;
        string collectionTime;

        [DataMember]
        public int CollectionPointID
        {
            get { return collectionPointID; }
            set { collectionPointID = value; }
        }

        [DataMember]
        public string CollectionPointName
        {
            get { return collectionPointName; }
            set { collectionPointName = value; }
        }

        [DataMember]
        public string CollectionTime
        {
            get { return collectionTime; }
            set { collectionTime = value; }
        }

        public static CollectionPointW convert(CollectionPoint collectionPoint)
        {
            CollectionPointW u = new CollectionPointW();

            u.CollectionPointID = collectionPoint.CollectionPointID;
            u.CollectionPointName = collectionPoint.CollectionPointName;
            u.CollectionTime = collectionPoint.CollectionTime.GetValueOrDefault().ToString();
            return u;
        }

        public static List<CollectionPointW> convertList(List<CollectionPoint> list)
        {
            List<CollectionPointW> listW = new List<CollectionPointW>();

            foreach (CollectionPoint x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}